<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0, minimal-ui">
    <meta name="author" content="">
    <title></title>  <link rel="icon" href="/template/pc1/images/wmh_favicon.ico" type="image/x-icon" />
    <% include("../inc/list_css.html"){}%>
</head>

<body>
<div class="ibox ">
    <div class="ibox-title">
        <div class="pull-left mbx navbar_title">
            <span>商品分类 </span>
            <span class="line">/</span>
            商品分类列表
        </div>
    </div>
    <div class="ibox-content">
        <div class="wrapper wrapper-content">
            <div class="row">
                <div class="col-sm-12" >
                    <div class="btn-group margin-vertical-4_0">
                        <button class="hive-btn-md-large hive-btn-primary" id="add">
                            <i class="icon-add" aria-hidden="true"></i>&nbsp;添加商品分类
                        </button>
                    </div>
                    <div id="eventsToolbar" class="form-inline hive_input">

                    </div>
                    <table id="rTableEvents" data-toggle="table" data-mobile-responsive="true" data-pagination="true" data-search="true" class="table-striped table-no-bordered fixed-table-container table-row-border-color table-hovered table-hover">
                        <thead>
                        <tr>
                            <th>分类名称</th>
                            <th>排序</th>
                            <th data-field="head" data-halign="center"  data-align="center" data-width="120">操作</th>
                        </tr>
                        </thead>
                        <tbody>
                        <%for(list in productCategoryTreeList){%>
                        <tr level="${list.level!}">
                            <td>
                        <span style="margin-left: ${list.level * 20}px;">
                            <%if (list.level == 0){%>
                                <i class="am-icon-folder-o"></i>
                            <%}else{%>
                                <i class="am-icon-folder-open-o"></i>
                            <%}%>
                        ${list.name}
                        </span>
                            </td>
                            <td>${list.orderList}</td>
                            <td>
                                <div>
                                    <div>
                                        <%if (list.children.~size > 0){%>
                                        <a disabled="disabled" href="javascript:void(0)" class="icon-delete hive_icon color_danger" data-toggle="tooltip" data-placement="top" title="删除" style="color:#999!important;"></a>
                                        <%}else{%>
                                        <a id="deleteAction" onclick="deleteCategory('${list.id}')"  href="javascript:void(0)" class="icon-delete hive_icon color_danger" data-toggle="tooltip" data-placement="top" title="删除"></a>
                                        <%}%>
                                        <a href="javascript:void(0)" class="icon-edit hive_icon color_normal" onclick="location.href='edit?id=${list.id}'" data-toggle="tooltip" data-placement="top" title="编辑"></a>
                                    </div>
                                </div>
                            </td>
                        </tr>
                        <%}%>
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
    </div>
</div>


<% include("../inc/list_js.html"){}%>

<script type="text/javascript">
    // 删除
    function deleteCategory(ids) {
        parent.layer.confirm('您确定要删除吗？', {
            btn: ['是','否'] //按钮
        }, function(){
            $.ajax({
                method:"post",
                url: 'delete',
                data:"id=" + ids + "",
                dataType: "json",
                async: false,
                success: function(data) {
                    parent.layer.msg(data.message);
                    if (data.status == "success") {
                        location.href='list';
                    }
                }
            });
        });
    }

    (function() {
        $(".wrapper").tooltip({selector:"[data-toggle=tooltip]",container:"body"});

        $('#add').on('click', function (e) {
            location.href = 'add';
        });


    })();
</script>
</body>

</html>
